package com.mika.config;

import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * mybatis的配置类
 *
 * @Author XiaoJiangShi
 * @Date 2022/8/22 10:45
 * @Blog blog.XiaoJiangShi.net/996.mba
 * @Description: mybatis的配置类
 */
@Configuration
public class MybatisConfig {
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor(){
        MybatisPlusInterceptor mp = new MybatisPlusInterceptor();
        //创建分页配件类
        PaginationInnerInterceptor pa = new PaginationInnerInterceptor();
        //设置查询页数大于最大页数，true即跳到第一页，false为默认值，即保持查询页数
        pa.setOverflow(true);
        mp.addInnerInterceptor(pa);
        return mp;
    }
}

